<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Garage door system',
	'<{subtitle}>' => 'Written in <span title="Software Engineering 1">CS 2401</span>, finalised on 2017-12-06',
	'<{copyright year}>' => '2017',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<p>
	For this assignment, we are to discuss an automated garage system that is to be developed.
</p>
<h2>Actors and goals</h2>
<p>
	Actors are those external to the system that interact with the system.
	In the motorised garage door system we are working with, not all of the actors actually have real &quot;goals&quot; because they don&apos;t <strong>*intend*</strong> to interact with the system; some actors are inanimate objects that happen to be in the vicinity that we want our system to account for.
	For those actors, we have goals for the actor, but the actor itself doesn&apos;t actually have a goal.
</p>
<h3>People</h3>
<p>
	The goal of the people will be to access the contents of the garage.
	Additionally, people will want to avoid being injured by the moving door itself.
</p>
<h3>Would-be criminals</h3>
<p>
	Owners of the house will want to avoid suspicious strangers sneaking around their home in the dark.
</p>
<h3>Objects and non-human animals</h3>
<p>
	Like humans, non-human animals will want to avoid being crushed by the door if someone attempts to close it while they are in the way.
	The humans will also want to avoid having non-human animals and objects crushed beneath the door.
</p>
<h2>Use cases</h2>
<h3>Open the garage door</h3>
<p>
	The user wants to open the door so they can access the content within.
	They may or may not have their remote transmitter on them, so a manual switch must also be available.
</p>
<h3>Close the garage door</h3>
<p>
	The user will want to close the garage door when they are done in there, as to prevent heat escape and burglary.
	However, they won&apos;t want to crush anyone or anything beneath the door.
	People and other animals could get injured and objects could be damaged; not to mention that the garage door itself could be damaged.
	If the user has left something in the doorway, the door shouldn&apos;t close on it.
</p>
<h3>Keep suspicious people away</h3>
<p>
	Disreputable people may try to break into the home if they think they can do so without being seen.
	By including a motion detector and a light external to the door, these people can be discourages and made leave, as the light will make it more likely that they&apos;ll be caught.
	The light will have no such impact on people that are supposed to be there, as they aren&apos;t hiding and can easily explain their presence (likely, they won&apos;t even <strong>*have*</strong> to explain).
</p>
<h2>Use case diagram</h2>
<img src="/img/CC_BY-SA_4.0/y.st./coursework/CS2401/use_case_diagram.png" alt="Use case diagram" class="framed-centred-image" width="640" height="400"/>
<h2>Opening the door remotely</h2>
<p>
	Opening the garage door requires the user to either hit a switch on a remote transmitter that they carry with them or hit a switch at the door itself.
</p>
<p>
	If the user chooses to use the transmitter, it&apos;ll send a radio signal that will be detected by the door&apos;s own radio receiver.
	For security reasons, the remote transmitter and local receiver should probably use a unique signal.
	However, the system isn&apos;t overly sophisticated, so if someone were to eavesdrop with a radio receiver while the transmitter were in use, they could duplicate the signal.
	However, this would take a lot of planning and effort, and most home invaders won&apos;t go through the trouble of trying to do that.
	Once the system receives the signal, it instructs the motor to wind up the chain, pulling the door open along the door&apos;s rail.
</p>
<h2>Sequence diagram</h2>
<img src="/img/CC_BY-SA_4.0/y.st./coursework/CS2401/sequence_diagram.png" alt="Sequence diagram" class="framed-centred-image" width="541" height="285"/>
<h2>Operation contract</h2>
<table>
	<tbody>
		<tr>
			<td>
				Operation
			</td>
			<td>
				Open the garage door
			</td>
		</tr>
		<tr>
			<td>
				Preconditions
			</td>
			<td>
				<ul>
					<li>
						The door is not already open
					</li>
					<li>
						A radio signal had been detected
					</li>
					<li>
						The radio signal detected matches the one specified as the open/close signal for this particular door
					</li>
				</ul>
			</td>
		</tr>
		<tr>
			<td>
				Postconditions
			</td>
			<td>
				<ul>
					<li>
						The chain is coiled, opening the door
					</li>
				</ul>
			</td>
		</tr>
	</tbody>
</table>
END
);
